<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>01</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<script type="text/javascript" src="vue.js"></script>
</head>
<body>
        <div id="app">
            <template v-if="type === 'name'">
                <label for="">用户名:</label>
                <input placeholder="输入用户名" key="input-name">
            </template>
            <template v-else>
                <label for="">邮箱:</label>
                <input placeholder="输入用户名" key="input-email">
            </template>
            <button type="" @click='handleToggleClick'>切换输入类型</button>
        </div>
    <script>
        var myApp = new Vue({
            el: '#app',
            data: {
                type:'name'
            },
            methods:{
                handleToggleClick :function(){
                    this.type = this.type === 'name' ? 'mail' :'name';
                }
            }
        });
    </script>
</body>
</html>